home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 4.6 KB | 176 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWOvlShp.cpp
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "FWOS.hpp"
-
- #ifndef FWOVLSHP_H
- #include "FWOvlShp.h"
- #endif
-
- #ifndef SLGRGLOB_H
- #include "SLGrGlob.h"
- #endif
-
- #ifndef FWGC_H
- #include "FWGC.h"
- #endif
-
- #ifndef FWGRUTIL_H
- #include "FWGrUtil.h"
- #endif
-
- #ifndef FWFXMATH_H
- #include "FWFxMath.h"
- #endif
-
- #ifndef SLRENDER_H
- #include "SLRender.h"
- #endif
- // ----- Foundation Includes -----
-
- #ifndef FWSTREAM_H
- #include "FWStream.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef SOM_ODTransform_xh
- #include <Trnsform.xh>
- #endif
-
- //========================================================================================
- // RunTime Info
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment FWGraphics_OvalShape
- #endif
-
- FW_DEFINE_AUTO(FW_COvalShape)
- FW_DEFINE_CLASS_M1(FW_COvalShape, FW_CBoundedShape)
-
- //========================================================================================
- // class FW_COvalShape
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // FW_COvalShape::FW_COvalShape
- //----------------------------------------------------------------------------------------
-
- FW_COvalShape::FW_COvalShape(const FW_COvalShape& other) :
- FW_CBoundedShape(other)
- {
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_COvalShape::FW_COvalShape
- //----------------------------------------------------------------------------------------
-
- FW_COvalShape::FW_COvalShape(const FW_CRect& rect,
- FW_ERenderVerbs renderVerb,
- const FW_CInk& ink,
- const FW_CStyle& style) :
- FW_CBoundedShape(rect, renderVerb, ink, style, FW_kNormalFont)
- {
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_COvalShape::FW_COvalShape
- //----------------------------------------------------------------------------------------
-
- FW_COvalShape::FW_COvalShape(FW_CReadableStream& stream) :
- FW_CBoundedShape(stream)
- {
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_COvalShape::~FW_COvalShape
- //----------------------------------------------------------------------------------------
-
- FW_COvalShape::~FW_COvalShape()
- {
- FW_START_DESTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_COvalShape::Render
- //----------------------------------------------------------------------------------------
-
- void FW_COvalShape::Render(FW_CGraphicContext& gc) const
- {
- FW_PrivRenderOval(gc.GetEnvironment(),
- gc,
- fRect,
- GetRenderVerb(),
- fInk,
- fStyle);
- FW_FailOnEvError(gc.GetEnvironment());
- }
-
- //----------------------------------------------------------------------------------------
- // FW_COvalShape::RenderOval
- //----------------------------------------------------------------------------------------
-
- void FW_COvalShape::RenderOval(FW_CGraphicContext& gc,
- const FW_CRect& rect,
- FW_ERenderVerbs renderVerb,
- const FW_CInk& ink,
- const FW_CStyle& style)
- {
- FW_PrivRenderOval(gc.GetEnvironment(),
- gc,
- rect,
- renderVerb,
- ink,
- style);
- FW_FailOnEvError(gc.GetEnvironment());
- }
-
- //----------------------------------------------------------------------------------------
- // FW_COvalShape::HitTest
- //----------------------------------------------------------------------------------------
-
- FW_Boolean FW_COvalShape::HitTest(FW_CGraphicContext& gc,
- const FW_CPoint& test,
- FW_Fixed tolerance) const
- {
- FW_UNUSED(gc);
- if(fRenderVerb == FW_kNoRendering)
- return FALSE;
-
- FW_CRect ovalRect(fRect);
- ovalRect.Inset(-tolerance, -tolerance);
-
- if (!::FW_PtInOval(ovalRect, test))
- return FALSE;
-
- if (fRenderVerb == FW_kFrame)
- {
- ovalRect = fRect;
- FW_Fixed inset = tolerance + GetPenSize();
- ovalRect.Inset(inset, inset);
- return ! ::FW_PtInOval(ovalRect, test);
- }
-
- return TRUE;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_COvalShape::Copy
- //----------------------------------------------------------------------------------------
-
- FW_CShape* FW_COvalShape::Copy() const
- {
- return FW_NEW(FW_COvalShape, (*this));
- }
-
-